-
Notifications
You must be signed in to change notification settings - Fork 155
Add test utility to create Nexus endpoint #1279
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| async def create_nexus_endpoint( | ||
| self, endpoint_name: str, task_queue: str | ||
| ) -> temporalio.api.nexus.v1.Endpoint: | ||
| """Create a Nexus endpoint with the given name and task queue. | ||
|
|
||
| Args: | ||
| endpoint_name: The name of the Nexus endpoint to create. | ||
| task_queue: The task queue to associate with the endpoint. | ||
|
|
||
| Returns: | ||
| The created Nexus endpoint. | ||
| """ | ||
| response = await self._client.operator_service.create_nexus_endpoint( | ||
| temporalio.api.operatorservice.v1.CreateNexusEndpointRequest( | ||
| spec=temporalio.api.nexus.v1.EndpointSpec( | ||
| name=endpoint_name, | ||
| target=temporalio.api.nexus.v1.EndpointTarget( | ||
| worker=temporalio.api.nexus.v1.EndpointTarget.Worker( | ||
| namespace=self._client.namespace, | ||
| task_queue=task_queue, | ||
| ) | ||
| ), | ||
| ) | ||
| ) | ||
| ) | ||
| return response.endpoint |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, but we should make sure that tests/helpers/nexus.py::create_nexus_endpoint is removed and this is used throughout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
| from tests.helpers import find_free_port, new_worker | ||
| from tests.helpers.metrics import PromMetricMatcher | ||
| from tests.helpers.nexus import create_nexus_endpoint, make_nexus_endpoint_name | ||
| from tests.helpers.nexus import make_nexus_endpoint_name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed import but usages remain causing NameError
High Severity
The import of create_nexus_endpoint from tests.helpers.nexus was removed, but there are still 4 usages of this function in the file at lines 802, 847, 881, and 2145. These tests (test_start_operation_headers, test_workflow_run_operation_headers, test_cancel_operation_headers, and another test) would fail with NameError: name 'create_nexus_endpoint' is not defined when run. These usages need to be updated to use env.create_nexus_endpoint(endpoint_name, task_queue) like the other tests.
Additional Locations (2)
|
It does have typechecking issues however. |


Add test utility to create Nexus endpoint. This matches what we have in Java and Dotnet
Note
Medium Risk
Introduces new public testing APIs that invoke operator-service RPCs; failures/mismatched server support could break test setups or external users relying on
WorkflowEnvironment.Overview
Adds
WorkflowEnvironment.create_nexus_endpoint()andWorkflowEnvironment.delete_nexus_endpoint()to create/delete Nexus endpoints via the operator service, returning the createdEndpoint.Refactors Nexus workflow-caller tests to stop using the ad-hoc
tests.helpers.nexus.create_nexus_endpointhelper and instead create endpoints through the test environment (threadingenvinto_start_wf_and_nexus_op).Written by Cursor Bugbot for commit 4d747a8. This will update automatically on new commits. Configure here.